require 'migration_helpers'

class CreateSchedules < ActiveRecord::Migration
  extend MigrationHelper::ForeignKeys
  
  def self.up
    create_table :schedules do |t|
      t.column :student_id,           :integer
      t.column :courses_sessions_id,  :integer
      t.column :session_id,           :integer
      t.column :course_id,            :integer
    end
    
    add_foreign_key(:schedules, :student_id, :students)
    add_foreign_key(:schedules, :courses_sessions_id, :courses_sessions)
    add_foreign_key(:schedules, :session_id, :sessions)
    add_foreign_key(:schedules, :course_id, :courses)
  end

  def self.down
    drop_table :schedules
  end
end
